structure Tokens : JAVA_TOKENS =
struct
  (* A "scaffold" structure for debugging lexers. *)
type ('svalue,'pos) token = string

type svalue = unit

fun print_token (pos,s) = 
 let val save = !ErrorMsg.anyErrors
  in ErrorMsg.error(pos,s); ErrorMsg.anyErrors := save; s
 end
 
fun CLASS(p) = print_token(p,"CLASS")
fun PUBLIC(p) = print_token(p,"PUBLIC")
fun STATIC(p) = print_token(p,"STATIC")
fun MAIN(p) = print_token(p,"MAIN")
fun EXTENDS(p) = print_token(p,"EXTENDS")
fun LENGTH(p) = print_token(p,"LENGTH")
fun SYSTEM_OUT_PRINTLN(p) = print_token(p,"SYSTEM_OUT_PRINTLN")
fun THIS(p) = print_token(p,"THIS")
fun NEW(p) = print_token(p,"NEW")
fun RETURN(p) = print_token(p,"RETURN")

fun INT(p) = print_token(p,"INT")
fun BOOLEAN(p) = print_token(p,"BOOLEAN")
fun STRING(p) = print_token(p,"STRING")
fun VOID(p) = print_token(p,"VOID")

fun IF(p) = print_token(p,"IF")
fun ELSE(p) = print_token(p,"ELSE")
fun THEN(p) = print_token(p,"THEN")

fun DO(p) = print_token(p,"DO")
fun WHILE(p) = print_token(p,"WHILE")

fun TRUE(p) = print_token(p,"TRUE")
fun FALSE(p) = print_token(p,"FALSE")

fun OR(p) = print_token(p,"OR")
fun NOT(p) = print_token(p,"NOT")
fun AND(p) = print_token(p,"AND")

fun GT(p) = print_token(p,"GT")
fun EQ(p) = print_token(p,"EQ")
fun LT(p) = print_token(p,"LT")

fun TIMES(p) = print_token(p,"TIMES")
fun MINUS(p) = print_token(p,"MINUS")
fun PLUS(p) = print_token(p,"PLUS")
fun ASSIGN(p) = print_token(p,"ASSIGN")
fun DIV(p) = print_token(p,"DIV")

fun RPAREN(p) = print_token(p,"RPAREN")
fun LPAREN(p) = print_token(p,"LPAREN")
fun RBRACE(p) = print_token(p,"RBRACE")
fun LBRACE(p) = print_token(p,"LBRACE")
fun RBRACK(p) = print_token(p,"RBRACK")
fun LBRACK(p) = print_token(p,"LBRACK")
fun COLON(p) = print_token(p,"COLON")
fun DOT(p) = print_token(p,"DOT")
fun SEMICOLON(p) = print_token(p,"SEMICOLON")
fun COMMA(p) = print_token(p,"COMMA")

fun ID(s,p1,p2) = print_token((p1,p2),"ID("^s^")")
fun INTEGER_LITERAL(c,p1,p2) = print_token((p1,p2),"INT("^Int.toString(c)^")")

fun COMMENT(p) = print_token(p,"COMMENT")
fun EOF(p) = print_token(p,"EOF")

end
